package com.wechatpay.v3.enums;

import java.util.Objects;

/**
 * 退款状态
 *
 * @author liuyi <liuy@pvc123.com>
 * @since 2021/8/18
 */
public enum  RefundStatus {

    SUCCESS("SUCCESS","退款成功"),
    CLOSED("CLOSED","退款关闭"),
    PROCESSING("PROCESSING","退款处理中"),
    ABNORMAL("ABNORMAL","退款异常"),
    ;

    public final String key;
    public final String value;

    RefundStatus(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static RefundStatus getRefundStatus(String key) {
        for (RefundStatus refundStatus : RefundStatus.values()) {
            if (Objects.equals(refundStatus.key,key)) {
                return refundStatus;
            }
        }

        return PROCESSING;
    }
}
